/* 1.position:aboslute margin: auto; left:0;right:0;top:0;bottom:0 */
.container1{
  background-color: pink;
  width: 100%;
  height: 100vh;
  position: relative;
}
.center1 {
  width: 200px;
  height: 200px;
  background-color: blue;
  position: absolute;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

/* flex */
.container2{
  background-color: pink;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
.center2 {
  width: 200px;
  height: 200px;
  background-color: blue;
}

/* tranform: tranlate(-50%,-50%) */
.container3{
  background-color: pink;
  width: 100%;
  height: 100vh;
  position: relative;
}
.center3 {
  width: 200px;
  height: 200px;
  background-color: blue;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
}

/* table */
.container4{
  /* background-color: pink; */
  width: 300px;
  height: 300px;
  display: table;
  /* text-align: center; */
  /* vertical-align: middle; */
}
.center4 {
  background-color: blue;
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}

/* gird */
.container5{
  background-color: pink;
  width: 100%;
  height: 100vh;
  display: grid;
  /* text-align: center; */
  /* vertical-align: middle; */
}

.center5 {
  background-color: blue;
  justify-self: center; 
  align-self: center;
  /* 以上可以简写为  place-self: center;*/
  height: 100px;
  width: 100px;
  /* float: left; */
  background-color: blueviolet;
}